#include <iostream>
using namespace std;

class Bookstore
{
	public :
		int m_id;
	public :
		Bookstore(int id = 0) :
			m_id(id)
		{}

		virtual void sell_fine()const = 0;
};

class Book : public Bookstore
{
	public :
		string m_name;
		int m_num;
	public :
		Book(int id = 1, string name = "Walden", int num = 0) :
			Bookstore(id), m_name(name), m_num(num)
		{}

		void sell_fine() const
		{
			if(m_id == 1)
			{
				if(m_num >= 500)
				{
					cout << "Sell Fine !" << endl << "Name : " << m_name << endl;
				}
				else
				{
					cout << "Sell Bad !" << endl;
				}
			}
			else
			{
				cout << "This is not a book !" << endl;
			}
		}

		friend istream& operator>>(istream& in, Book& b1);
};

istream& operator>>(istream& in, Book& b1)
{
	in >> b1.m_id >> b1.m_name >> b1.m_num;
	return in;
}

class Magazine : public Bookstore
{
	public :
		string m_name;
		int m_num;
	public :
		Magazine(int id = 2, string name = "Life", int num = 0 ) : 
			Bookstore(id), m_name(name), m_num(num)
		{}

		void sell_fine() const
		{
			if(m_id == 2)
			{
				if(m_num >= 2500)
				{
					cout << "Sell Fine !" << endl << "Name : " << m_name << endl;
				}
				else
				{
					cout << "Sell Bad !" << endl;
				}
			}
			else
			{
				cout << "This is not a magazine !" << endl;
			}
		}

		friend istream& operator>>(istream& in, Magazine& m1);
};

istream& operator>>(istream& in, Magazine& m1)
{
	in >> m1.m_id >> m1.m_name >> m1.m_num;
	return in;
}

int main()
{
	cout << "<Book_id = 1 ; Magazine_id = 2>" << endl;
	Book b1;
	cin >> b1;
	b1.sell_fine();
	cout << endl;

	cout << "<Book_id = 1 ; Magazine_id = 2>" << endl;
	Magazine m1;
	cin >> m1;
	m1.sell_fine();
	cout << endl;
}
